import request from '@/utils/request'
import { loginFormData, loginResponseData, userInfoResponseData } from './type'
// 请求地址
enum API {
    LOGIN_URL = '/admin/acl/index/login',
    USERINFO_URL = '/admin/acl/index/info',
    LOGOUT_URL = '/admin/acl/index/logout'
}

// 登录接口
export const LoginAPI = (data: loginFormData) => request.post<any, loginResponseData>(API.LOGIN_URL, data)

// 获取用户信息
export const UserInfoAPI = () => request.get<any, userInfoResponseData>(API.USERINFO_URL)

// 退出登录
export const LogoutAPI = () => request.post<any, any>(API.LOGOUT_URL)

// import type { login, loginResponseData, userResponseData } from './type'
// enum API {
//     LOGIN_URL = '/user/login',
//     USERINFO_URL = '/user/info'
// }
// // 登录接口
// export const LoginAPI = (data: login) => {
//     return request.post<any, loginResponseData>(API.LOGIN_URL, data)
// }


// // 获取用户信息
// export function UserInfoAPI() {
//     // 打印res为undefined 又忘记写return
//    return request.get<userResponseData>(API.USERINFO_URL)
// }